//
//  NSString+Additions.m
//  laziz_Consumer
//
//  Created by ZhaoDongBo on 2016/11/11.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import "NSString+Additions.h"

@implementation NSString (Additions)

+ (BOOL)isStringEmpty:(NSString *)string {
    if ([string length] == 0) { //string is empty or nil
        return YES;
    }

    return ![[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length];

}



/**
 连接字符串，忽略nil变量。

 @param first .
 @param ... .
 @return .
 */
NSString *combination(NSString *first, ...) {
    va_list arg;

    va_start(arg, first);

    NSString *str;

    NSMutableString *result = [[NSMutableString alloc] initWithString:first];

    while (![(str = va_arg(arg, NSString *)) isEqual:XXXXXBOUND]) {
        [result appendString:str ?: @""];
    }

    va_end(arg);

    return [result copy];
}

@end
